package com.example.netty.channelHandler优化;

import com.example.netty.encode.Packet.PackerCode;
import com.example.netty.encode.Packet.Packet;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * 编码处理器
 * @author liupk
 * @date 2018/11/7
 */
public class PacketEncoder extends MessageToByteEncoder<Packet> {
    
    @Override
    protected void encode(ChannelHandlerContext ctx, Packet msg, ByteBuf out) throws Exception {
        PackerCode.getINSTANCE().encode(out,msg);
    }
}